#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
--建库
create database if not exists ol_edu_dm;

drop table if exists ol_edu_dm.dm_intent;
create table if not exists ol_edu_dm.dm_intent
(
        date_time string,
        time_type string,
        day string,
        month string,
        year string,
        group_type_new string comment '分组字段',
        origin_type string comment'线上线下',
        clue_state string comment'新老学员',
        area string comment '地区',
        itcast_subject_id int comment '学科id',
        itcast_subject string comment '学科名称',
        itcast_school_id int comment '校区id',
        itcast_school string comment '校区名称',
        origin_channel string comment '来源渠道',
        department_id int comment '部门id',
        department_name string comment '部门名称',
        intent_avl_count bigint comment '意向用户个数'
)comment '意向统计宽表'
row format delimited
fields terminated by '\t'
stored as orc tblproperties ('orc.compress'='snappy');



drop table if exists ol_edu_dm.dm_clue;
create table if not exists ol_edu_dm.dm_clue
(
        date_time string,
        time_type string,
        day string,
        group_type_new string comment '分组字段',
        origin_type string comment'线上线下',
        clue_state string comment'新老学员',
        clue_avl_count bigint comment '有效线索个数',
        clue_total_count bigint comment '总线索个数'
)comment '线索统计宽表'
row format delimited
fields terminated by '\t'
stored as orc tblproperties ('orc.compress'='snappy');
"